//
//  SongRecommendListViewModel.swift
//  TimMusic
//
//  Created by nkl on 2024/10/14.
//

import Foundation
import TSVideoKit

class SongRecommendListViewModel : NSObject ,BasicSongListViewModelProtocol {
    @Published var datas: [TSVideoKit.TSVideo] = []
    
    func requestData() {
        datas = TSVideoOperator.shared.playerViewModel.currentVideos
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        datas.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: SongListCell.cellIdentify, for: indexPath) as! SongListCell
        if indexPath.row < datas.count {
            let video = datas[indexPath.row]
            cell.bindData(video: video)
        }
        return cell
    }
}
